<?php

namespace app\qsapi\validate;

use think\Validate;

class MemberValidate extends Validate
{
    protected $rule =   [
        'game_id' =>'require|number',
        'type' => 'require|in:1,2',
        'account'  => 'require|max:50',
        'password'   => 'require',
        'code' => 'require',
        'captcha_key'=>'require',
        'phone'=>'require|mobile'
    ];

    protected $message  =   [
        'game_id.require' => '游戏ID不能为空',
        'game_id.number'   => '游戏ID必须是数字',

        'type.require' => 'type类型必须',
        'type.in' => 'type只能是1或2',

        'account.require'     => '用户名不能为空',
        'account.max'     => '用户名最大为50',

        'password.require'=>'密码是必须的',

        'code.require'=>'验证码不能为空',
        'code.alpha'=>'验证码必须是字母',
        'code.length'=>'验证码长度必须为4位',

        'captcha_key'=>'captcha_key是必须的',

        'phone.require'=>'电话号码是必须的',
        'phone.mobile'=>'不是一个有效的电话号码'
    ];

    protected $scene = [
        'password'  =>  ['account','password','type','captcha_key','code','game_id'],
        'phone'=>['phone','code','type','game_id']
    ];
}